Skip to content

London | 26-ITP-Jan | Divine Mankrado | Sprint 3 | Practice TDD#1239

Open
divinmank wants to merge 7 commits intoCodeYourFuture:mainfrom
divinmank:coursework/sprint-3-practice-tdd
Open

London | 26-ITP-Jan | Divine Mankrado | Sprint 3 | Practice TDD#1239
divinmank wants to merge 7 commits intoCodeYourFuture:mainfrom
divinmank:coursework/sprint-3-practice-tdd

Conversation

@divinmank
Copy link

@divinmank divinmank commented Mar 10, 2026

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Finished the practice TDD segment of sprint 3.

@divinmank divinmank added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 10, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 10, 2026
@divinmank divinmank added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 10, 2026
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Function implementation is correct.

  • A few tests could use some improvement.

Comment on lines +26 to +38
test("should return 0 if the character does not exist in the string", () => {
const str = "hello";
const char = "z";
const count = countChar(str, char);
expect(count).toEqual(0);
});

test("should return 0 if the character does not exist in the string", () => {
const str = "hello";
const char = "z";
const count = countChar(str, char);
expect(count).toEqual(0);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated.

// Case 4: Numbers ending with 11, 12, 13, or any other digit
// When the number ends with 11, 12, 13, or any digit not 1, 2, or 3,
// Then the function should return a string by appending "th" to the number.
test("should append 'th' for numbers ending with 11, 12, 13, or other digits", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a test fails with the message "... or other digits", it may be unclear what "other digits" actually refers to.
Can you revise the test description to make it more informative?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could consider testing a few more samples in this script - higher chance to detect bugs in code.

The original specification did not clearly state whether the character match should be case-sensitive.
Most people would probably assume that it is, but to demonstrate our understanding or clarify the assumption we made,
we could add test cases to convey this. For examples,

  • A case to show that the match is case sensitive
  • A case to show that the function is expected to work also for non-alphabets

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 14, 2026
@divinmank
Copy link
Author

Thanks for the feedback!

  1. Removed the duplicated test in count.test.js
  2. Improved the test description for ordinal numbers to make it clearer
  3. Added additional test cases for case sensitivity, non-alphabet characters, and more sample inputs
    Let me know if there’s anything else I can improve

Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other changes look good. I will mark this PR as complete first.

You should also add the "Needs Review" label when your PR is ready to be re-reviewed.

Comment on lines +43 to +47
test("should append 'th' for numbers ending with 11, 12, or 13", () => {
expect(getOrdinalNumber(11)).toEqual("11th");
expect(getOrdinalNumber(12)).toEqual("12th");
expect(getOrdinalNumber(13)).toEqual("13th");
expect(getOrdinalNumber(4)).toEqual("4th");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description is still not quite accurate. Numbers like 4 and 10 does not end with 11, 12, or 13.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Mar 23, 2026
@github-actions
Copy link

The changed files in this PR don't match what is expected for this task.

Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints.

Please review the changed files tab at the top of the page, we are only expecting changes in this directory: ^Sprint-3/2-practice-tdd/

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

1 similar comment
@github-actions
Copy link

The changed files in this PR don't match what is expected for this task.

Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints.

Please review the changed files tab at the top of the page, we are only expecting changes in this directory: ^Sprint-3/2-practice-tdd/

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this file to keep the branch clean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants